<template>
	<view class="points-item" @click="toDtail">
		<u--image :src="info.image && info.image[0].url" width="100%" height="160px"></u--image>
		<view class="points-item-title u-line-2">{{info.goodsName}}</view>
		<view class="points-item-num" v-if="info.price>0" :style="{color: appColor}">{{info.score}}积分+{{info.price}}元</view>
		<view class="points-item-num" v-else :style="{color: appColor}">{{info.score}}积分</view>
		<view class="points-item-num1">剩余{{info.stock}}件</view>
	</view>
</template>

<script>
	import {mapActions} from 'vuex';
	export default {
		name: 'PointsItem',
		props: {
			info: {
				type: Object,
				default: function() {
					return {}
				}
			}
		},
		computed: {
			appColor() {
				return this.appPrimaryColor
			}
		},
		methods: {
			...mapActions(['setDetail']),
			toDtail() {
				this.setDetail({detail: this.info});
				this.$cuNavigateTo('/pages/me/pointsDetail');
			}
		}
	}
</script>

<style lang="scss" scoped>
	.points-item {
		background-color: #fff;
		overflow: hidden;
		.points-item-title {
			font-size: 28rpx;
			color: #000;
			padding: 0 16rpx;
			margin: 16rpx 0;
		}
		.points-item-num {
			font-size: 24rpx;
			line-height: 24rpx;
			padding: 0 16rpx;
		}
		.points-item-num1 {
			font-size: 24rpx;
			line-height: 24rpx;
			padding: 16rpx;
			color: #999;
		}
	}
</style>